package crp.core.workflow.domain.models;

import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

@Getter
@Setter
@Builder
public class WorkflowInstanceContext {
    private String topic;
    private String externalId;
    private String submittedBy;
    private Map<String, String> formAttributes;

    public void appendFormAttributes(Map<String, String> formAttributes) {
        if (this.formAttributes == null) {
            this.formAttributes = new HashMap<>();
        }
        this.formAttributes.putAll(formAttributes);
    }

    public void appendFormAttributes(String key, String value) {
        if (this.formAttributes == null) {
            this.formAttributes = new HashMap<>();
        }
        this.formAttributes.put(key, value);
    }
}
